<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var n = parseInt(prompt('请输入一个数', '6'));
    for (var i = 1; i <= 6; i++) {
      if (6 % i === 0) {
        console.log(n + '的约数是' + i);
      }
    }
  </script>
</body>

</html>